/*******************************************************************************
* STYL 10-Year Replication: Package Installation
*
* Purpose: Installs all required Stata packages from SSC and Stata archives
*
* Note: Requires internet connection. Run this file once before running the
*       master do file. If any installation fails, packages can be installed
*       manually using the commands below.
*
* Tested with: Stata 14+
*******************************************************************************/

* ftools: Fast data manipulation tools (collapse, egen, sort)
* Required by: reghdfe
ssc install ftools, replace

* reghdfe: Linear regression with high-dimensional fixed effects
* Used for: All ITT regressions with stratification fixed effects
ssc install reghdfe, replace

* coefplot: Plotting regression coefficients
* Used for: Figure 1 (Average treatment effects), Figure 2 (Heterogeneous effects)
ssc install coefplot, replace

* astile: Fast percentile/quantile calculation
* Used for: Creating percentile-based variables and censoring outliers
ssc install astile, replace

* outreg: Formatting regression output for publication
* Includes: frmttable (used for LaTeX table generation)
ssc install outreg, replace

* mdesc: Describes patterns of missing data
* Used for: Data quality checks during construction
ssc install mdesc, replace

* fsum: Fast summary statistics
* Used for: Summary tables and balance checks
ssc install fsum, replace

* dm74: Date manipulation utilities (from Stata Technical Bulletin)
* Note: Uses older HTTP URL - may fail on some systems. If installation fails,
*       this package may not be critical for core replication results.
net install dm74, from("http://www.stata.com/stb/stb52/") replace
